package com.share.jdbc.raw;

import com.share.common.type.ShardingType;
import com.share.jdbc.factory.DataSourceFactory;

import javax.sql.DataSource;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * @desc: 原生java分表
 * @author:caifan
 * @date:2020/11/15
 */
public class JavaConfigurationMain {

    private static ShardingType shardingType = ShardingType.SHARDING_TABLES;

    public static void main(String[] args) throws SQLException  {
        DataSource dataSource = DataSourceFactory.newInstance(shardingType);
        PreparedStatement preparedStatement = dataSource.getConnection().prepareStatement("create table t_order (id bigint(20) primary  key, order_no varchar(20))");
        preparedStatement.execute();
    }
}
